package 数组;

import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;

/**
 * @Project: data-structure-and-algorithms
 * @Package: 数组
 * @ClassName: t925
 * @Author: zhouyihe
 * @Date: 2025/11/25 14:03
 * @Description: 长按输入
 */
public class t925 {
    public boolean isLongPressedName(String name, String typed) {
        int i = 0, j = 0;
        while (j < typed.length()) {
            if (i < name.length() && name.charAt(i) == typed.charAt(j)) {
                i++;
                j++;
            } else if (j > 0 && typed.charAt(j) == typed.charAt(j - 1)) {
                j++;
            } else {
                return false;
            }
        }
        return i == name.length();
    }
}
